<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="../../static/personal_center/css/index.css">
    <link rel="stylesheet" type="text/css" href="../../static/personal_center/css/common.css">
    <script type="text/javascript" src="../../static/personal_center/js/index.js"></script>
    <link rel="stylesheet" href="../../static/personal_center/font_2369197_oqktwkt71s/iconfont.css" media="screen">
    <link rel="stylesheet" href="../../static/public_file/css/PersonnelChooser.css">
    <style>
        .add_background {
            background: #A9A9A9;
        }
        .li-class {
            list-style: none;
            margin-top: 2%;
            color: #0b0b0b;
            cursor: pointer;
            height: 30px;
            line-height: 30px;
        }
        .file {
            position: relative;
            display: inline-block;
            background: #D0EEFF;
            border: 1px solid #99D3F5;
            border-radius: 3px;
            padding: 4px 12px;
            overflow: hidden;
            color: #1E88C7;
            text-decoration: none;
            text-indent: 0;
            line-height: 20px;
        }
        .file input {
            position: absolute;
            font-size: 100px;
            right: 0;
            top: 0;
            opacity: 0;
        }
        .file:hover {
            background: #AADFFD;
            border-color: #78C3F3;
            color: #004974;
            text-decoration: none;
        }

        thead tr th {
            position: sticky;
            top: 0; /* 列首永远固定在头部  */
            background-color: #E8E8E8;
        }
        .button_for_control {
            width: 90px;
            height: 30px;
            border: 1px solid #99D3F5;
            background: #D0EEFF;
            border-radius: 4px;
            letter-spacing: 0;
            line-height: 30px;
            color: #089bab;
            margin: 5px 0;
        }
        #loading { background: #fff url(../../static/public_file/images/jiazai.gif) no-repeat scroll center center; height: 100%; width: 100%; background-size: 10%; position: fixed; margin-top: 0px; top: 0px; left: 0px; bottom: 0px; overflow: hidden !important; right: 0px; z-index: 999999;background-color: rgba(255, 255, 255, 0.08);}
    </style>
</head>
<body>
    <div id="loading">
        <div id="loading-center">
        </div>
    </div>

    <div id="new_models1" class="shade">
        <div id="new_models" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 600px;height: 200px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="box" style="width: 100%;height: 40px;background: #f4f7fa;cursor: move;border-top-left-radius: 3px;border-top-right-radius: 3px;line-height: 40px;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 20%;margin-left: 1%;display: inline-block;line-height: 0px;font-size: 14px;">
                        创建职能小组
                    </div>
                    <span onclick="close_models()" style="float: right;padding-right: 2%;cursor: pointer;">
                        <i class="iconfont icon-quchu"></i>
                    </span>
                </div>
                <div style="height: 105px;width: 100%;border-bottom: #dfdfdf solid 1px;">
                    <div style="margin-top: 2%;padding-left: 20px;">
                        <label>小组名称：</label>
                        <input id="ks_name" type="text" placeholder="" style="width: 80%;border-radius: 3px;border: #dfdfdf solid 1px;height: 30px;outline: none;">
                    </div>
                    <div style="margin-top: 2%;padding-left: 20px;">
                        <label>小组人员：</label>
                        <input onclick="model_line_with_parameters('1')" id="people" type="text" placeholder="" style="width: 80%;border-radius: 3px;border: #dfdfdf solid 1px;height: 30px;outline: none;">
                    </div>
                </div>
                <div style="width: 100%;height: 40px;padding-right: 2%;padding-left: 2%;">
                    <button id="summit_but" onclick="confirm()" style="width: 100px;height: 30px;border: #dfdfdf solid 1px;margin-top: 5px;border-radius: 3px;background: #1E90FF;color: white;margin-right: 15px;float: right;">
                        提交
                    </button>

                    <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: left;">
                        上传文件
                        <input type="file" name="party_main_body" id="party_main_body" onchange="upload_excel('new_add', 0)">
                    </a>
                </div>
            </div>
        </div>
    </div>

    <div id="new_models2" class="shade">
        <div id="new_models2" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 300px;height: 150px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div style="height: 115px;width: 100%;border-bottom: #dfdfdf solid 1px;text-align: center;line-height: 100px;">
                    <div style="line-height: 100px;">
                        <i class="iconfont icon-jinggao-chucuo" style="color: red;font-size: 20px;"></i>
                        <p style="margin-bottom: 20px;display: inline-block;">确认删除该分组！</p>
                    </div>
                </div>
                <div style="width: 100%;text-align: right;padding-right: 2%;">
                    <button onclick="guanbi()" style="width: 60px;height: 25px;border: #dfdfdf solid 1px;margin-top: 5px;border-radius: 3px;background: #1E90FF;color: white;margin-right: 10px;line-height: 20px;display: inline-block;">
                        取消
                    </button>
                    <button id="summit_but2" style="width: 60px;height: 25px;border: #dfdfdf solid 1px;margin-top: 5px;border-radius: 3px;background: red;color: white;margin-right: 15px;line-height: 20px;display: inline-block;">
                        确认
                    </button>
                </div>
            </div>
        </div>
    </div>

    <div id="new_models4" class="shade">
        <div id="new_models3" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 600px;height: 500px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="box3" style="width: 100%;height: 50px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;line-height: 50px;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 20%;margin-left: 1%;display: inline-block;line-height: 0px;font-size: 20px;">
                        <button onclick="model_line()" style="width: 70px;height: 30px;border-radius: 3px;border: #00a0e9 solid 1px;background: #00a0e9;color: white;cursor: pointer;">添加</button>
                    </div>
                    <span onclick="close_models3()" style="float: right;padding-right: 2%;cursor: pointer;">
                        <i class="iconfont icon-quchu"></i>
                    </span>
                </div>
                <div style="height: 405px;width: 100%;border-bottom: #dfdfdf solid 1px;overflow: auto;">
                    <table style="width: 100%;border-collapse: collapse;margin: 0;padding: 0;text-align: center;">
                        <thead>
                            <tr>
                                <th style="width: 7%;border: #cfcfcf solid 1px;height: 35px;border-top: none;border-left: none;">序号</th>
                                <th style="width: 41%;border: #cfcfcf solid 1px;height: 35px;border-top: none;">姓名</th>
                                <th style="width: 41%;border: #cfcfcf solid 1px;height: 35px;border-top: none;">工号</th>
                                <th style="width: 11%;border: #cfcfcf solid 1px;height: 35px;border-top: none;border-right: none;">操作</th>
                            </tr>
                        </thead>
                        <tbody style="overflow: auto;width: 100%;" id="tboday_xg">
                        </tbody>
                    </table>
                </div>
                <div style="width: 100%;height: 50px;padding-right: 2%;padding-left: 2%;">
                    <button id="summit_but3" style="width: 100px;height: 30px;border: #dfdfdf solid 1px;margin-top: 5px;border-radius: 3px;background: #1E90FF;color: white;margin-right: 15px;float: right;">
                        提交
                    </button>
                    <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: left;">
                        上传文件
                        <input type="file" name="party_main_body1" id="party_main_body1">
                    </a>
                </div>
            </div>
        </div>
    </div>

    <div style="width: 100%;height: 40px;border-bottom: #cfcfcf solid 1px;background: white;font-size: 0;text-align: right;padding-right: 15px;">
        <div id="" style="width: 100px;float: right;text-align: center;margin-right: 1%;height: 40px;">
            <button id="" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
                    style="width: 110px;height: 30px;line-height: 27px;border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;">
                操作
            </button>
        </div>

        <div id="page_one" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
             style="z-index: 1000; position: absolute; width: 100px; height: auto;top: 35px;background: #FFFFFF; box-shadow: rgb(204 204 204) 2px 2px 10px;padding: 5px;display: none;">
            <button id="approve" onclick='line_model()' class="button_for_control">
                创建
            </button>

            <button id="submit_data" class="button_for_control">
                <a href="../../static/back_management/excel_template/职能分组模板.xlsx">下载模板</a>
            </button>
        </div>
    </div>

    <div style="width: 100%;height: 100%;background: white;">
        <div id="my_application" style="width: 100%;height: 100%;overflow: auto;background-color: white;">
            <div class="right-box" style="width: 100%;height: 100%;margin-top: 0;">
                <div style="height: 100%;width: 100%;overflow: auto;border-bottom: #cccccc solid 1px;background-color: white;">
                    <section class="grid-main" style="height: calc(100vh - 45px);">
                        <table id="main_table"></table>
                    </section>
                </div>
            </div>
        </div>
    </div>

    <div id="staff-select" class="shade">
        <div id="staff-model" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 900px;height: 500px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="staff-box" style="width: 100%;height: 40px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 20%;margin-left: 1%;display: inline-block;line-height: 40px;font-size: 14px;">
                        选择人员
                    </div>
                    <span onclick="close_model()" style="float: right;padding-right: 2%;cursor: pointer;line-height: 37px;">
                        <i class="iconfont icon-quchu"></i>
                    </span>
                </div>
                <div style="height: 460px;width: 100%;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 70px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div id="dep" class="navigation navigation_color" onclick="change_navigation(this)">部门</div>
                        <div id="limits" class="navigation" onclick="change_navigation(this)">权限</div>
                        <div id="fun" class="navigation" onclick="change_navigation(this)">职能</div>
                    </div>
                    <div style="width: 200px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div style="width: 100%;height: 50px;line-height: 50px;">
                            <input id="SearchDep" onkeydown="SearchDepartment()" class="search_input" type="text" placeholder="搜索" autocomplete="off">
                        </div>
                        <div id="SecondaryNavigation" style="width: 100%;height: 403px;line-height: 50px;overflow: auto;"></div>
                    </div>
                    <div style="width: 200px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div style="width: 100%;height: 50px;line-height: 50px;">
                            <input type="checkbox" id="select-all" onclick="SelectAll(this)">
                            <input id="SearchPeo" onkeydown="SearchProple()" class="search_input" type="text" placeholder="搜索" autocomplete="off" style="width: 65%;">
                        </div>
                        <div id="ThreeNavigation" style="width: 100%;height: 403px;line-height: 50px;overflow: auto;"></div>
                    </div>
                    <div style="width: 410px;height: 100%;display: inline-block;vertical-align: top;overflow: auto">
                        <div style="width: 100%;height: 40px;text-align: left;font-size: 14px;line-height: 40px;">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;已选 <span id="selected-number">0</span> 人
                        </div>
                        <div id="selected-div" style="width: 100%;font-size: 14px;height: 370px;overflow: auto;line-height: 20px;">

                        </div>
                        <div style="width: 100%;font-size: 14px;height: 40px;text-align: center;">
                            <button id="finish_with" onclick="IdentifyPersonnel()" style="width: 100px;height: 30px;line-height: 25px;text-align: center;letter-spacing: 5px;border-radius: 3px;border: #cfcfcf solid 1px;font-size: 14px;cursor: pointer;margin-top: 10px;">完成</button>
                            <button onclick="close_model()" style="margin-left: 15px;width: 100px;height: 30px;line-height: 25px;text-align: center;color: #0abb78;letter-spacing: 5px;border-radius: 3px;font-size: 14px;border: #cfcfcf solid 1px;cursor: pointer;margin-top: 10px;">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript" src="../../static/administrative/js/other/jquery.js"></script>
    <script type="text/javascript" src="../../static/public_file/js/PersonnelChoosersNew.js" charset="gb2312"></script>
    <script>
        const gridManagerName = "test",
        TYPE_MAP = {1: "HTML/CSS", 2: "nodeJS", 3: "javaScript", 4: "前端鸡汤", 5: "PM Coffee", 6: "前端框架", 7: "前端相关"},
        GM_PUBLISH_METHOD_MAP = {
            init: {key: "init", relyInit: !1, title: "初始化", code: 'demo1.initGM(document.querySelector("table"));'},
            get: {key: "get", relyInit: !0, title: "获取表格的实时配置信息", code: `GridManager.get('${gridManagerName}');`},
            version: {key: "version", relyInit: !1, title: "获取当前GridManager的版本号", code: "GridManager.version;"},
            getLocalStorage: {
                key: "getLocalStorage",
                relyInit: !0,
                title: "获取表格用户记忆",
                code: `GridManager.getLocalStorage('${gridManagerName}');`
            },
            resetLayout: {
                key: "resetLayout",
                relyInit: !0,
                title: "重置表格布局",
                code: `GridManager.resetLayout('${gridManagerName}', '800px', '500px');`
            },
            clear: {
                key: "clear",
                relyInit: !0,
                title: "清除表格记忆数据",
                code: `GridManager.clear('${gridManagerName}');`
            },
            getTableData: {
                key: "getTableData",
                relyInit: !0,
                title: "获取指定tr所使用的数据",
                code: `GridManager.getTableData('${gridManagerName}');`
            },
            getRowData: {
                key: "getRowData",
                relyInit: !0,
                title: "获取指定tr所使用的数据",
                code: `GridManager.getRowData('${gridManagerName}', document.querySelector("table[grid-manager=${gridManagerName}] tbody tr"));`
            },
            updateRowData: {
                key: "updateRowData",
                relyInit: !0,
                title: "更新指定行所使用的数据",
                code: `GridManager.updateRowData('${gridManagerName}', 'id', {id: 112, title: 'ccc'});`
            },
            updateTreeState: {
                key: "updateTreeState",
                relyInit: !0,
                title: "更新树的展开状态",
                code: `GridManager.updateTreeState('${gridManagerName}', true);`
            },
            setSort: {
                key: "setSort",
                relyInit: !0,
                title: "手动设置排序",
                code: `GridManager.setSort('${gridManagerName}', {createDate: 'ASC'});`
            },
            setConfigVisible: {
                key: "setConfigVisible",
                relyInit: !0,
                title: "设置表头配置区域可视状态",
                code: `GridManager.setConfigVisible('${gridManagerName}', true);`
            },
            setLineHeight: {
                key: "setLineHeight",
                relyInit: !0,
                title: "配置行的高度",
                code: `GridManager.setLineHeight('${gridManagerName}', '70px');`
            },
            showTh: {
                key: "showTh",
                relyInit: !0,
                title: "设置列为可视状态",
                code: `GridManager.showTh('${gridManagerName}', 'pic');`
            },
            hideTh: {
                key: "hideTh",
                relyInit: !0,
                title: "设置列为隐藏状态",
                code: `GridManager.hideTh('${gridManagerName}', 'pic');`
            },
            exportGrid: {
                key: "exportGrid",
                relyInit: !0,
                title: "导出指定表格",
                code: `GridManager.exportGrid('${gridManagerName}', 'demo中使用的导出').then(res=>{console.log('success')}).catch(err=>{console.error('error', err)});`
            },
            setQuery: {
                key: "setQuery",
                relyInit: !0,
                title: "更改在生成组件时所配置的参数query",
                code: `GridManager.setQuery('${gridManagerName}', {'userName':'baukh','sex':'男'});`
            },
            setAjaxData: {
                key: "setAjaxData",
                relyInit: !0,
                title: "用于再次配置ajaxData数据",
                code: `GridManager.setAjaxData('${gridManagerName}', {data: [{title: '通过setAjaxData动态添加的数据，其它项为空'}], totals: 1});`
            },
            refreshGrid: {
                key: "refreshGrid",
                relyInit: !0,
                title: "刷新表格",
                code: `GridManager.refreshGrid('${gridManagerName}');`
            },
            renderGrid: {
                key: "renderGrid",
                relyInit: !0,
                title: "渲染表格",
                code: `GridManager.renderGrid('${gridManagerName}');`
            },
            getCheckedTr: {
                key: "getCheckedTr",
                relyInit: !0,
                title: "获取当前选中的行",
                code: `GridManager.getCheckedTr('${gridManagerName}');`
            },
            getCheckedData: {
                key: "getCheckedData",
                relyInit: !0,
                title: "获取选中行的渲染数据",
                code: `GridManager.getCheckedData('${gridManagerName}');`
            },
            setCheckedData: {
                key: "setCheckedData",
                relyInit: !0,
                title: "设置选中的数据",
                code: `GridManager.setCheckedData('${gridManagerName}', [GridManager.getTableData('${gridManagerName}')[1]]);`
            },
            cleanData: {
                key: "cleanData",
                relyInit: !0,
                title: "清除指定表格数据",
                code: `GridManager.cleanData('${gridManagerName}');`
            },
            print: {key: "print", relyInit: !0, title: "打印当前页", code: `GridManager.print('${gridManagerName}');`},
            showRow: {
                key: "showRow",
                relyInit: !0,
                title: "显示隐藏行",
                code: `GridManager.showRow('${gridManagerName}', 1);`
            },
            hideRow: {
                key: "hideRow",
                relyInit: !0,
                title: "隐藏行",
                code: `GridManager.hideRow('${gridManagerName}', 1);`
            },
            showLoading: {
                key: "showLoading",
                relyInit: !0,
                title: "显示加载中",
                code: `GridManager.showLoading('${gridManagerName}');`
            },
            hideLoading: {
                key: "hideLoading",
                relyInit: !0,
                title: "隐藏加载中",
                code: `GridManager.hideLoading('${gridManagerName}', 300);`
            },
            destroy: {
                key: "destroy",
                relyInit: !0,
                title: "消毁指定的GridManager实例",
                code: `GridManager.destroy('${gridManagerName}');`
            }
        }, arg = {
            gridManagerName: "test",
            width: "100%",
            height: "100%",
            autoOrderConfig: {fixed: "left"},
            checkboxConfig: {key: "id", fixed: "left"},
            supportAjaxPage: !0,
            sortMode: "single",
            supportMenu: !0,
            menuHandler: e => (e.unshift({
                content: "自定义菜单", line: !0, onClick: e => {
                    alert(e)
                }
            }), e),
            useCellFocus: !0,
            useHideRow: !0,
            supportMoveRow: !0,
            moveRowConfig: {
                key: "priority", useSingleMode: !0, fixed: "left", handler: (e, t) => {
                    console.log(e, t)
                }
            },
            disableCache: !1,
            ajaxData: function (e, t) {
                var local_host = window.location.host;          // 获取当前IP
                return "/back-management/FunctionalGrouping.html"
            },
            exportConfig: {
                fileName: e => {
                    const t = new Date;
                    let a = `${t.getFullYear()}-${t.getMonth() + 1}-${t.getDate()}`;
                    for (let t in e) a = `${a}-${t}=${e[t]}`;
                    return a
                }, suffix: "xls"
            },
            ajaxType: "POST",
            checkedBefore: function (e, t, a) {
                return console.log("checkedBefore==", e, t, a), a && 90 === a.id && alert("该节点在checkedBefore中配置为不可选"), a && 90 !== a.id
            },
            checkedAfter: function (e, t, a) {
                console.log("checkedAfter==", e, t, a)
            },
            checkedAllBefore: function (e, t) {
                console.log("checkedAllBefore==", e, t)
            },
            checkedAllAfter: function (e, t) {
                console.log("checkedAllAfter==", e, t)

            },
            sortingBefore: function (e) {
                console.log("sortingBefore", e)
            },
            sortingAfter: function (e) {
                console.log("sortingAfter", e)
            },
            ajaxBeforeSend: function (e) {
                console.log("ajaxBeforeSend")
            },
            ajaxSuccess: function (e) {
                document.getElementById("loading").style.display = "none";
                console.log("ajaxSuccess")
            },
            ajaxError: function (e) {
                console.log("ajaxError")
            },
            ajaxComplete: function (e) {
                console.log("ajaxComplete")
            },
            adjustBefore: e => {
                console.log("adjustBefore=>", e)
            },
            adjustAfter: e => {
                console.log("adjustAfter=>", e)
            },
            responseHandler: e => (e.data.forEach((e => {
                e.priority = e.id
            })), e),
            rowRenderHandler: (e, t) => e,
            emptyTemplate: e => `<div style="text-align: center;">${e.query.title ? "搜索为空" : "暂无数据"}</div>`,
            columnData: [
                {
                    key: "describe",
                    text: "名称",
                    align: "center",
                    width: "350px",
                    disableMoveRow: !0
                },{
                    key: "people",
                    text: "人员",
                    align: "left",
                },{
                    key: "action",
                    width: "150px",
                    align: "center",
                    fixed: "right",
                    disableMoveRow: !0,
                    disableRowCheck: !0,
                    text: '操作',
                    template: (e, t) => `<a class="plugin-action" href="javascript:;" onclick="line_model3(${t.id})">修改</a> | <a class="plugin-action" href="javascript:;" onclick="jinggao(${t.id})" style="color: red;">删除</a>`
                }]
        }, demo1 = {
            initSearch: function () {

            }, initFN: () => {

            }, initGM: function () {
                new window.GridManager(table, arg, (e => {
                    console.log("渲染完成后的回调函数:", e), console.log(arg.columnData)
                }))
            }, editRowData: function (e) {
                window.GridManager.updateRowData("test", "id", {
                    id: window.parseInt(e.getAttribute("data-id")),
                    lastDate: (new Date).getTime()
                })
            }
        }, table = document.querySelector("#main_table");
        demo1.initSearch(table), demo1.initGM(table), demo1.initFN();

        function line_model() {
            document.getElementById("new_models1").style.display = "table-row";
        }

        function close_models() {
            document.getElementById("new_models1").style.display = "none";
        }

        let title = document.querySelector("#box");
        let addForm = document.querySelector("#new_models");
        title.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm.offsetLeft;
            let y = e.pageY - addForm.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                addForm.style.left = e.pageX - x + 'px';
                addForm.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function do_delete(id) {
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/function_delete_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id=" + String(id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var JsonDate = JSON.parse(xhr.responseText);
                        alert(JsonDate['message'])
                        location.reload()

                    }
                }
            }
        }

        function jinggao(ids) {
            document.getElementById("new_models2").style.display="table-row";
            document.getElementById("summit_but2").setAttribute("onclick", "do_delete('"+ids+"')")
        }

        function guanbi() {
            document.getElementById("new_models2").style.display="none";
        }

        function confirm() {
            var name = $('#ks_name').val()
            var people = $('#people').val()
            console.log(name, people)
            if (!name) {
                alert('请填写名称')
                return false
            }
            if (!people) {
                alert('请选择人员')
                return false
            }
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/function_list_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("describe=" + String(name) + "&people=" + String(people));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var JsonDate = JSON.parse(xhr.responseText);
                        alert(JsonDate['message'])
                        location.reload()
                    }
                }
            }
        }

        let title1 = document.querySelector("#title");
        let addForm1 = document.querySelector("#addForm");
        title1.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm1.offsetLeft;
            let y = e.pageY - addForm1.offsetTop;


            document.addEventListener("mousemove", move);
            function move(e) {
                addForm1.style.left = e.pageX - x + 'px';
                addForm1.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        let title3 = document.querySelector("#box3");
        let addForm3 = document.querySelector("#new_models3");
        title3.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm3.offsetLeft;
            let y = e.pageY - addForm3.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                addForm3.style.left = e.pageX - x + 'px';
                addForm3.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function close_models3() {
            document.getElementById("new_models4").style.display = "none";
        }

        function line_model3(group_id) {
            document.getElementById("new_models4").style.display = "table-row";
            document.getElementById("summit_but3").setAttribute("onclick", "add_functional('"+group_id+"')")
            document.getElementById("party_main_body1").setAttribute("onchange", "upload_excel('renew', '"+group_id+"')")
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('get', "/back-management/FunctionalGrouping.html?id="+String(group_id), true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send();
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var JsonDate = JSON.parse(xhr.responseText);
                        create_table(JsonDate["function_list"])
                    }
                }
            }
        }

        function create_table(JsonData, types="") {
            var tboday_xg = document.getElementById("tboday_xg");
            if (!types) {
                tboday_xg.innerHTML="";
            }
            for (var i=0; i<JsonData.length; i++) {
                var tr = document.createElement("tr");
                var td = document.createElement("td");var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");
                td.innerHTML=JsonData[i]["Serial"];td.style.width="7%";td.style.border="#cfcfcf solid 1px";td.style.borderTop='none';td.style.borderLeft='none';td.style.height="35px";td.className='td_class';
                td1.innerHTML=JsonData[i]["real_name"];td1.style.width="41%";td1.style.border="#cfcfcf solid 1px";td1.style.height="35px";td1.style.borderTop='none';
                td2.innerHTML=JsonData[i]["job_number"];td2.style.width="41%";td2.style.border="#cfcfcf solid 1px";td2.style.height="35px";td2.style.borderTop='none';
                td3.innerHTML="<a href='javascript:;' id='"+JsonData[i]["Serial"]+"' style='text-decoration: none;color: red;' onclick='delete_people(this)'>删除</a>"
                td3.style.width="11%";td3.style.border="#cfcfcf solid 1px";td3.style.borderTop='none';td3.style.borderRight='none';td3.style.height="35px";
                tr.appendChild(td);tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tboday_xg.appendChild(tr);
            }
        }
        
        function delete_people(_this) {
            var remove_number = parseInt(_this.id);             // a标签的id，对应的本行的序号
            var td_list = document.getElementsByClassName("td_class");
            for (var i=0; i<td_list.length; i++) {
                var this_id = parseInt(td_list[i].innerHTML);
                if (this_id > remove_number) {
                    td_list[i].innerHTML=i;
                    document.getElementById(String(i+1)).id=i;
                }
            }
            $(_this).parent().parent().remove();
        }

        function add_functional(group_id) {
            var tr_list = document.getElementById("tboday_xg").childNodes;
            var str_list = [];
            for (var i=0; i<tr_list.length; i++) {
                var td_list = tr_list[i].childNodes;
                var user_name = td_list[1].innerText;
                var job_number = td_list[2].innerText;
                str_list.push(user_name+"("+job_number+")");
            }
            var new_str = str_list.join(", ")
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/function_list_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id="+String(group_id)+"&people="+String(new_str));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var JsonDate = JSON.parse(xhr.responseText);
                        alert(JsonDate['message'])
                        location.reload()
                    }
                }
            }
        }

        function upload_excel(types, group_id) {
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();

            form.append('file', files);
            form.append('types', types);
            if (types === 'new_add') {
                var name = $('#ks_name').val()
                var files = document.getElementById("party_main_body").files[0];
                form.append('name', name);
            }else {
                files = document.getElementById("party_main_body1").files[0];
                form.append('group_id', group_id);
            }
            form.append('file', files);
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/UploadExcel", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert(JsonDate['message'])
                        if (JsonDate['code'] === 200) {
                            location.reload()
                        }
                        document.getElementById("party_main_body").value="";
                        document.getElementById("party_main_body1").value="";
                    }
                }
            };
        }

        function page_zhanshi() {
            document.getElementById('page_one').style.display = 'inline-block';
        }

        function page_yincang() {
            document.getElementById('page_one').style.display = 'none';
        }

        function scrollConversationScreen() {
            $('#selected-div').scrollTop($('#selected-div')[0].scrollHeight);
        }

        function IdentifyPersonnel(ele_id='0') {
            var td_number = document.getElementById("tboday_xg").childNodes.length+1;
            var prople_list = [];var JsonData = [];
            var selected_personnel_list = document.getElementsByClassName('selected-personnel');
            for (var i=0; i<selected_personnel_list.length; i++) {
                prople_list.push(selected_personnel_list[i].innerText)
            }
            if (ele_id === '0') {
                var executor = prople_list.join();
                var str_list = executor.split(",");
                for (var j=0; j<str_list.length; j++) {
                    var this_list = str_list[j].split("(");
                    JsonData.push({"real_name": this_list[0], "job_number": this_list[1].replace(")", ''), "Serial": td_number});
                    td_number += 1;
                 }
                create_table(JsonData, "add");
            }else {
                document.getElementById("people").value = prople_list.join();
            }
            close_model()
        }
    </script>
</body>
</html>